home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / BBS / MUBBS / MUBBS112.CPT / MUBBS112 / MUBBS Mod Shells 4_92.cpt / Shells / Module std routines / MUBBS Misc.c < prev    next >
Text File  |  1992-02-13  |  2KB  |  117 lines

  1. /*
  2.  *  MUBBS misc.c
  3.  *
  4.  *    This program source code and it's compiled version is
  5.  *  Copyright (c) 1991 N. Hawthorn.
  6.  *  This program source code and it's compiled version IS NOT IN THE
  7.  *  PUBLIC DOMAIN ! Please read the "COPYRIGHT NOTICE / NH" file for details
  8.  *  regarding use of this program source code and it's compiled version.
  9.  *
  10.  *
  11.  * Code to make your life eaiser !
  12.  *
  13.  */
  14.  
  15.  
  16. #include "MUBBS Module.h"
  17.  
  18.  
  19.  
  20. /* These two routines change string formats from C to Pascal and back
  21.  
  22. PtoCstr(tstring); where are these located ?? in C or Mac ????
  23. CtoPstr(tstring); this one returns a pointer ??
  24.  
  25. */
  26.  
  27. /* You can use these routines to switch things around if you want, they are */
  28. /* already written for you ! */
  29.  
  30. /* we have to put prototypes here because we didn't compile these in this
  31.  * file only
  32. */
  33.  
  34.  
  35. removespaces(temp)
  36. char *temp;
  37. {
  38. int len;
  39. len = strlen(temp) - 1; /* takes out trailing spaces */
  40. while ((temp[len] == '\x20') && (len > 0)){
  41.     temp[len] = '\0';
  42.     len--;
  43.     }
  44. }
  45.  
  46. pStrCopy( p2, p1 )
  47. char *p2, *p1;
  48. /* copies a pascal string from p1 to p2 */
  49. {
  50.     int len;
  51.     
  52.     len = *p2++ = *p1++;
  53.     while (--len>=0) *p2++=*p1++;
  54. }
  55.  
  56.  
  57. strtoupper(str1) /* makes a string all uppercase */
  58. char *str1;
  59. {
  60. int i = 0,l;
  61. l=strlen(str1);
  62. do {
  63.     str1[i] = toupper(str1[i]);
  64.     } while (++i < l);
  65. }
  66.  
  67.  
  68. strcatc(str,c) /* appends a character to a string */
  69. char *str,c;
  70. {
  71. char n[2];
  72. n[0]=c;
  73. n[1]=0;
  74.     strcat(str,n) ;
  75. }
  76. /*    end of function        */
  77.  
  78. strtolong(n,str)
  79. char *str;
  80. long *n;
  81.     {
  82.     sscanf(str,"%ld",&n) ;
  83.     }
  84. /*    end of function        */
  85.  
  86. longtostr(n,str)
  87. char *str;
  88. long n;
  89.     {
  90.     sprintf(str,"%ld",n) ;
  91.     }
  92. /*    end of function        */
  93.  
  94. strtoint(str)
  95. char *str;
  96.     {
  97. int n=0;
  98.     sscanf(str,"%d",&n) ;
  99.     return(n);
  100.     }
  101. /*    end of function        */
  102.  
  103. inttostr(n,str)
  104. char *str;
  105. int n;
  106.     {
  107.     sprintf(str,"%d",n) ;
  108.     }
  109. /*    end of function        */
  110.  
  111. getdatetime(datetime)
  112. char *datetime;
  113. {
  114. gettime("%m/%d/%y %I:%M:%S %p",datetime); /* gets the date & time */
  115. }
  116.  
  117.